<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
    <title>${not empty pmDataTree.treeName?pmDataTree.treeName:'树形字典'}管理</title>
    <meta name="decorator" content="default"/>
    <script type="text/javascript">
        $(document).ready(function () {
            //$("#name").focus();
            $("#inputForm").validate({
                submitHandler: function (form) {
                    loading('正在提交，请稍等...');
                    form.submit();
                },
                errorContainer: "#messageBox",
                errorPlacement: function (error, element) {
                    $("#messageBox").text("输入有误，请先更正。");
                    if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
                        error.appendTo(element.parent().parent());
                    } else {
                        error.insertAfter(element);
                    }
                }
            });
        });
    </script>
</head>
<body>
<ul class="nav nav-tabs">
    <li><a href="${ctx}/pm/pmDataTreeItem/listByDataTreeId?dataTreeId=${pmDataTree.id}">${not empty pmDataTree.treeName?pmDataTree.treeName:'树形字典'}列表</a></li>
    <li class="active"><a href="${ctx}/pm/pmDataTreeItem/form?id=${pmDataTreeItem.id}">${not empty pmDataTree.treeName?pmDataTree.treeName:'树形字典'}
        <shiro:hasPermission name="pm:pmDataTreeItem:edit">${not empty pmDataTreeItem.id?'修改':'添加'}</shiro:hasPermission>
        <shiro:lacksPermission name="pm:pmDataTreeItem:edit">查看</shiro:lacksPermission></a></li>
</ul>
<br/>
<form:form id="inputForm" modelAttribute="pmDataTreeItem" action="${ctx}/pm/pmDataTreeItem/save" method="post" class="form-horizontal">
    <form:hidden path="id"/>
    <form:hidden path="dataTreeId" value="${pmDataTree.id}"/>
    <sys:message content="${message}"/>
    <c:if test="${pmDataTree.maxLevel > '1'}">
        <div class="control-group">
            <label class="control-label">父节点：</label>
            <div class="controls">
                <sys:treeselect id="parentId" name="parentId" value="${pmDataTreeItem.parentId}" labelValueUrl="/pm/pmDataTreeItem/treeValue"
                                title="父节点" url="/pm/pmDataTreeItem/treeData?dataTreeId=${pmDataTree.id}" cssClass="required"/>
                <span class="help-inline" style="color:red">*</span>
            </div>
        </div>
    </c:if>
    <div class="control-group">
        <label class="control-label">名称：</label>
        <div class="controls">
            <form:input path="name" htmlEscape="false" maxlength="255" class="input-xlarge " cssClass="required"/>
        </div>
    </div>
    <c:if test="${'Y' == pmDataTree.extAttr1Edit}">
        <div class="control-group">
            <label class="control-label">${pmDataTree.extAttr1Name}：</label>
            <div class="controls">
                <c:if test="${'input' == pmDataTree.extAttr1Type}">
                    <form:input path="extAttr1" htmlEscape="false" maxlength="255" class="input-xlarge " cssClass="${'Y' == pmDataTree.extAttr1Need?'required':''}"/>
                </c:if>
                <c:if test="${'textarea' == pmDataTree.extAttr1Type}">
                    <form:textarea path="extAttr1" htmlEscape="false" rows="4" maxlength="255" class="input-xxlarge" cssClass="${'Y' == pmDataTree.extAttr1Need?'required':''}"/>
                </c:if>
            </div>
        </div>
    </c:if>
    <c:if test="${'Y' == pmDataTree.extAttr2Edit}">
        <div class="control-group">
            <label class="control-label">${pmDataTree.extAttr2Name}：</label>
            <div class="controls">
                <c:if test="${'input' == pmDataTree.extAttr2Type}">
                    <form:input path="extAttr2" htmlEscape="false" maxlength="255" class="input-xlarge " cssClass="${'Y' == pmDataTree.extAttr2Need?'required':''}"/>
                </c:if>
                <c:if test="${'textarea' == pmDataTree.extAttr2Type}">
                    <form:textarea path="extAttr2" htmlEscape="false" rows="4" maxlength="255" class="input-xxlarge" cssClass="${'Y' == pmDataTree.extAttr2Need?'required':''}"/>
                </c:if>
            </div>
        </div>
    </c:if>
    <c:if test="${'Y' == pmDataTree.extAttr3Edit}">
        <div class="control-group">
            <label class="control-label">${pmDataTree.extAttr3Name}：</label>
            <div class="controls">
                <form:input path="extAttr3" htmlEscape="false" maxlength="255" class="input-xlarge " cssClass="${'Y' == pmDataTree.extAttr3Need?'required':''}"/>
            </div>
        </div>
    </c:if>
    <c:if test="${'Y' == pmDataTree.extAttr4Edit}">
        <div class="control-group">
            <label class="control-label">${pmDataTree.extAttr4Name}：</label>
            <div class="controls">
                <form:input path="extAttr4" htmlEscape="false" maxlength="255" class="input-xlarge " cssClass="${'Y' == pmDataTree.extAttr4Need?'required':''}"/>
            </div>
        </div>
    </c:if>
    <c:if test="${'Y' == pmDataTree.extAttr5Edit}">
        <div class="control-group">
            <label class="control-label">${pmDataTree.extAttr5Name}：</label>
            <div class="controls">
                <form:input path="extAttr5" htmlEscape="false" maxlength="255" class="input-xlarge " cssClass="${'Y' == pmDataTree.extAttr5Need?'required':''}"/>
            </div>
        </div>
    </c:if>
    <c:if test="${'Y' == pmDataTree.extAttr6Edit}">
        <div class="control-group">
            <label class="control-label">${pmDataTree.extAttr6Name}：</label>
            <div class="controls">
                <form:input path="extAttr6" htmlEscape="false" maxlength="255" class="input-xlarge " cssClass="${'Y' == pmDataTree.extAttr6Need?'required':''}"/>
            </div>
        </div>
    </c:if>
    <c:if test="${'Y' == pmDataTree.extAttr7Edit}">
        <div class="control-group">
            <label class="control-label">${pmDataTree.extAttr7Name}：</label>
            <div class="controls">
                <form:input path="extAttr7" htmlEscape="false" maxlength="255" class="input-xlarge " cssClass="${'Y' == pmDataTree.extAttr7Need?'required':''}"/>
            </div>
        </div>
    </c:if>
    <div class="control-group">
        <label class="control-label">排序：</label>
        <div class="controls">
            <form:input path="sort" htmlEscape="false" maxlength="11" class="input-xlarge " placeholder="默认自动排序"/>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">备注信息：</label>
        <div class="controls">
            <form:textarea path="remarks" htmlEscape="false" rows="4" maxlength="255" class="input-xxlarge "/>
        </div>
    </div>
    <div class="form-actions">
        <shiro:hasPermission name="pm:pmDataTreeItem:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
    </div>
</form:form>
</body>
</html>